package bupt.party.online.dao;

import java.util.List;
import java.util.Set;

import org.hibernate.criterion.DetachedCriteria;

import bupt.party.online.model.Admin;

public interface IAdminDao extends IBaseDao<Admin>{
	
	public void delete(Long id);

	public void save(Admin user);

	public void update(Admin user);

	public List<Admin> findAll();

	public List<Admin> findBySqlString(String sql);
	
	public List<Admin> find(String queryString,Object... values);
	
	public Integer getRecordAcount(DetachedCriteria criteria);
	
	public List<Admin> findPageResult(DetachedCriteria criteria ,int firstResult,int maxResult);
	
	
	public Admin findAdminByUserIdAndPassword(String userId , String password);
	
	/**
	 * 保存或者更新
	 * @param admin
	 * @return
	 */
	public boolean saveOrUpdateAdmin(Admin admin);
	
	
	/**
	 * 根据管理员的工号查出管理员的名字
	 * @param adminNO
	 * @return
	 */
	public String findAdminNameByAdminNO(String adminNO);
	
	
	/**
	 * 根据管理员的工号查出管理员
	 * @param adminNO
	 * @return
	 */
	public Admin findAdminByAdminNO(String adminNO);
	
	/**
	 * 根据管理员的工号 和 管理员管理的党支部的集合  查找党支部管理员 
	 * @param adminNO
	 * @param branch_ids
	 * @return
	 */
	public Admin  findAdminByAdminNOAndBranchIds(String adminNO,Set<Integer> branch_ids );
	
	
	/**
	 * 构造查询条件
	 * @param highLevelQuery
	 * @param queryContent
	 * @param firstpa
	 * @param secondpa
	 * @return
	 */
	public DetachedCriteria getDetachedCriteria(Integer highLevelQuery,
			String queryContent, Integer firstpa,
			Integer secondpa,String adminNO);
	
	
	/**
	 * 查询管理员数量
	 * @param detachedCriteria
	 * @return
	 */
	public int queryAdminCountWithCriteria(DetachedCriteria detachedCriteria);
	
	
	/**
	 * 查询管理员列表
	 * @param detachedCriteria
	 * @param firstResult
	 * @param maxResults
	 * @return
	 */
	public List<Admin> queryAdminWithCriteria(DetachedCriteria detachedCriteria,
			int firstResult, int maxResults);
	/**
	 * 根据工号逻辑删除管理员  isdelete设置为1
	 * @param adminNO
	 * @return
	 */
	public boolean deleteAdminByAdminNO(String adminNO);
}
